package com.edu.exam.enums;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 教师分配状态枚举
 *
 * @author System
 * @version 1.0.0 */
public enum TeacherAssignmentStatus implements BaseEnum {
    PROPOSED("PROPOSED", "提议中"),
    CONFIRMED("CONFIRMED", "已确认"),
    REJECTED("REJECTED", "已拒绝"),
    CANCELLED("CANCELLED", "已取消"),
    COMPLETED("COMPLETED", "已完成"),
    SUSPENDED("SUSPENDED", "已暂停"),
    PENDING("PENDING", "待处理");

    private final String code;
    private final String description;

    TeacherAssignmentStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static TeacherAssignmentStatus fromCode(String code) {
        for (TeacherAssignmentStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }

    public static TeacherAssignmentStatus fromDescription(String description) {
        for (TeacherAssignmentStatus status : values()) {
            if (status.getDescription().equals(description)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown description: " + description);
    }

    @Override
    public String toString() {
        return description;
    }
}